package com.ai.test2.service;

import com.ai.test2.dao.ProviderMapper;
import com.ai.test2.model.Provider;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * Date:  2018/11/5
 * Time:  13:49
 * Email: siy@hmgsoft.com
 * Created by siy
 */
@Service("providerServiceConfirm")
public class ProviderServiceConfirm implements ProviderService {

	@Resource
	private ProviderMapper providerMapper;

	@Override
	@Transactional
	public void increaseAmount(String id, int amount) {
		Provider provider = providerMapper.selectByPrimaryKey(id);
		provider.setTCount(provider.getTCount()-amount);
		providerMapper.updateByPrimaryKeySelective(provider);
	}
}
